from common.base_page import BasePage
from time import sleep
from page_locators.login_page_locators import LoginPageLocators as LPL
from page_locators.role_manage_page_locators import RoleManagePageLocators as RML

class RoleManage(BasePage):

    def __init__(self,driver):
        super().__init__(driver)

    def click_role_manage(self):
        self.click(LPL.role_manage, '角色管理定位点击')
        sleep(1)

    def click_add_role(self):
        self.click(RML.add_role, "添加角色定位点击")

    def add_role(self):
        self.click_add_role()    # 点击添加角色
        self.input(RML.role_name, "测试角色1", "角色名称输入")
        self.click(RML.type_teacher, "角色类型选择")
        self.click(RML.add_role_sure, "添加角色确定按钮点击")

    def delete_role2(self):
        self.click(RML.delete_sub, "测试角色2的删除按钮点击")
        self.click(RML.sure_delete, "系统提示确认删除按钮")

    def click_edit(self):
        self.click(RML.edit, "点击列表第一条的编辑按钮")
        sleep(1)

    def modify_role_name(self):
        self.input(RML.role_name, "测试角色2", "角色名称输入")
        self.click(RML.edit_sure, "修改角色确定按钮")

    def edit_role(self):
        self.click_edit()
        self.modify_role_name()


